package com.lg.distributed.idempotence.controller;

import com.lg.distributed.idempotence.annotation.AutoIdempotent;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @author by Mr. Li 2020/12/10 18:36
 */
@RestController
public class TestController {

    @GetMapping("/test")
    @AutoIdempotent(prefix = "idempotent")
    public String test() throws InterruptedException {

        //LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(300));
        Thread.sleep(20000);

        return "ok";
    }

}
